@extends('admin.app')

@section('breadcrumb')
    <div class="bg-light lter b-b wrapper-md">
        <ol class="breadcrumb bg-light lter m-n no-padder">
            <li><a href="{{admin_action('HomeController@index')}}">主页</a></li>
            <li><a href="{{admin_action('Web\InformationsController@index')}}">信息模板</a></li>
            <li class="active">信息模板信息</li>
        </ol>
    </div>
@endsection
@section('content')
    <div class="panel panel-default">
        <div class="panel-heading font-bold">
            信息模板列表
        </div>
        <diV class="panel-body">
            <form action="{{ admin_action('Web\InformationsController@index') }}" class="form-horizontal">
                <div class="form-group">
                    <label for="input1" class="col-sm-1 control-label">模板类型</label>
                    <div class="col-sm-2">
                        <select name="in_type" class="form-control">
                            <option value="">----请选择模板类型----</option>
                            @foreach ($types as $type)
                                <option value="{{$type->code}}" {{$type->code==$arr['in_type']?'selected':''}}>{{$type->name}}</option>
                            @endforeach
                        </select>
                    </div>
                    <label for="input1" class="col-sm-1 control-label">标题</label>
                    <div class="col-sm-2">
                        <input name="in_title" class="form-control" value="{{$arr['in_title']}}" type="text" placeholder="请输入标题"/>
                    </div>
                    <label for="input1" class="col-sm-1 control-label">位置</label>
                    <div class="col-sm-2">
                        <select name="in_position" class="form-control">
                            <option value>-----请选择信息位置-----</option>
                            @foreach ($positions as $position)
                                <option value="{{$position->code}}" {{$arr['in_position']==$position->code?'selected':''}}>{{$position->name}}</option>
                            @endforeach
                        </select>
                    </div>

                </div>
                <div class="form-group">
                    <label for="input1" class="col-sm-1 control-label">是否启用</label>
                    <div class="col-sm-2">
                        <label class="radio-inline i-checks i-checks-sm">
                            <input type="radio" name="in_state" value="1" {{$arr['in_state']?'checked':''}}>
                            <i ></i> 是
                        </label>
                        <label class="radio-inline i-checks i-checks-sm">
                            <input type="radio" name="in_state" value="0" {{$arr['in_state']?'':'checked'}}>
                            <i ></i> 否
                        </label>
                    </div>
                    <div class="col-sm-9 text-right">
                        <button type="submit" class="btn btn-primary">查询</button>
                        <a class="btn btn-default btn-addon" href="{{ admin_action('Web\InformationsController@create') }}">
                            <i class="fa fa-plus"></i>新增信息模板
                        </a>
                    </div>
                </div>
            </form>
            <div class="table-responsive">
                <table class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th style="width: 10px">#</th>
                        <th>标题</th>
                        <th>模板类型</th>
                        <th>位置</th>
                        <th>状态</th>
                        <th style="width: 100px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @forelse($informations as $information)
                        <tr>
                            <td>{{$information->id}}</td>
                            <td><a href="{{admin_action('Web\InformationsController@show',[$information])}}" class="text-info-dker">{{$information->title}}</a></td>
                            <td>{{$information->type()->name}}</td>
                            <td>{{$information->position() ? $information->position()->name : ''}}</td>
                            <td>{{$information->state?'启用':'禁用'}}</td>
                            <td>
                                <a href="{{admin_action('Web\InformationsController@edit',[$information])}}" class="btn btn-primary btn-xs" title="编辑信息" ><i class="fa fa-pencil"></i></a>
                                <form class="inline" method="post" action="{{admin_action('Web\InformationsController@destroy',[$information])}}">
                                    {{ method_field('DELETE') }}
                                    {{ csrf_field() }}
                                    <button type="button" data-swal-role="delete-confirm" class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除信息">
                                        <i class="fa fa-trash-o"></i>
                                    </button>
                                </form>
                            </td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="3" class="text-center">没有找到信息模板记录</td>
                        </tr>
                    @endforelse
                    </tbody>
                </table>
            </div>
        </diV>
        <div class="panel-footer">
            <div class="row">
                <div class="col-sm-12 text-right text-center-xs">
                    {{ $links }}
                </div>
            </div>
        </div>
    </div>
@endsection